placesview: Make middle click work
authorMatthias Clasen <mclasen@redhat.com>
Tue, 12 Dec 2017 18:56:15 +0000 (13:56 -0500)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 12 Dec 2017 18:57:06 +0000 (13:57 -0500)
This does not cost us much, and improves consistency.

gtk/gtkplacesview.c

index f8a2e22c6f462168cb03ac5bce3c859bd414984c..2a79add475f4fc0f4808e1232da1956d6cb65b4d 100644 (file)
@@ -1897,10 +1897,21 @@ on_listbox_row_activated (GtkPlacesView    *view,
                           GtkWidget        *listbox)
 {
   GtkPlacesViewPrivate *priv;
+  GdkEvent *event;
+  guint button;
+  GtkPlacesOpenFlags open_flags;
 
   priv = gtk_places_view_get_instance_private (view);
 
-  activate_row (view, row, priv->current_open_flags);
+  event = gtk_get_current_event ();
+  gdk_event_get_button (event, &button);
+
+  if (gdk_event_get_event_type (event) == GDK_BUTTON_RELEASE && button == GDK_BUTTON_MIDDLE)
+    open_flags = GTK_PLACES_OPEN_NEW_TAB;
+  else
+    open_flags = priv->current_open_flags;
+
+  activate_row (view, row, open_flags);
 }
 
 static gboolean